package com.atguigu.gmall.product.client;


import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.model.product.*;
import com.atguigu.gmall.product.client.impl.ProductDegradeFeignClient;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 远程调用 商品微服务的Feign接口
 */
@FeignClient(name = "service-product",fallback = ProductDegradeFeignClient.class)
public interface ProductFeignClient {

    //获取SkuInfo（SkuImage集合）
    @GetMapping("/api/product/inner/getSkuInfo/{skuId}")
    public SkuInfo getSkuInfo(@PathVariable(name = "skuId") Long skuId);

    //根据三级分类ID查询分类视图
    @GetMapping("/api/product/inner/getCategoryView/{category3Id}")
    public BaseCategoryView getCategoryView(@PathVariable(name = "category3Id") Long category3Id);
    // 查询销售属性 及属性值 及 选中当前商品

    @GetMapping("/api/product/inner/getSpuSaleAttrListCheckBySku/{skuId}/{spuId}")
    public List<SpuSaleAttr> getSpuSaleAttrListCheckBySku(
            @PathVariable(name = "skuId") Long skuId,
            @PathVariable(name = "spuId") Long spuId

    );

    //点击其他销售属性值的组合，跳转到另外的sku页面
    @GetMapping("/api/product/inner/getSkuValueIdsMap/{spuId}")
    public Map getSkuValueIdsMap(@PathVariable(name = "spuId") Long spuId);


    //单独获取库存的价格
    @GetMapping("/api/product/inner/getSkuPrice/{skuId}")
    public BigDecimal getSkuPrice(@PathVariable(name = "skuId") Long skuId);


    //为了首页加载一二三级商品分类
    @GetMapping("/api/product/getBaseCategoryList")
    public Result getBaseCategoryList();


    //Sku相关的平台属性及属性值 集合
    @GetMapping("/api/product/inner/getAttrList/{skuId}")
    public List<SkuAttrValue> getAttrList(@PathVariable(name = "skuId") Long skuId);

    //Sku相关的品牌信息
    @GetMapping("/api/product/inner/getTrademark/{tmId}")
    public BaseTrademark getTrademark(@PathVariable(name = "tmId") Long tmId);
}
